package com.example.administrator.myproject.utils

import android.graphics.Bitmap
import android.graphics.BitmapFactory
import com.example.administrator.myproject.utils.BitMapUtils.getBitmapOption

object BitMapUtils {
    fun getBitMap(url: String): Bitmap {
        return BitmapFactory.decodeFile(url, getBitmapOption(2))
    }

    private fun getBitmapOption(inSampleSize: Int): BitmapFactory.Options {
        System.gc()
        val options = BitmapFactory.Options()
        options.inPurgeable = true
        options.inSampleSize = inSampleSize
        return options
    }
}
